#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import g
from commonMod import *
import json

class JsonCommon(CommonMod):

    #--------------------------------------------------------------------------
    def __init__(
          self
    ):
        CommonMod.__init__(self)
        self.js = None

    #--------------------------------------------------------------------------
    def raw(self):
        return self.js

    #--------------------------------------------------------------------------
    def print(self):
        print(json.dumps(self.raw(), indent=4, sort_keys=True))

#------------------------------------------------------------------------------
class JsonConfig(JsonCommon):

    #--------------------------------------------------------------------------
    def __init__(
          self
        , fileName
    ):
        JsonCommon.__init__(self)
        try:
            with open(fileName, 'r', encoding='utf-8') as f:
                self.js = json.load(f)
        except BaseException as err:
            self.printErr(err)

    #--------------------------------------------------------------------------
    def __del__(self):
        pass
